#----------------------------
# Name: Joe Desrochers
# Project: Madlibs.py
# Period: 2
# Start Date: 9/17/2013
# Last Revision Date: 9/17/2013
# Version: 1.0.0
#----------------------------

swearFilter = ["dumb",
               "stupid",
               "retard",
               "fuck",
               "shit",
               "bitch",
               "cock",
               "pussy",
               "ass",
               "asshole",
               "motherfucker",
               "hell",
               "crap",
               "dick",
               "gook",
               "chink",
               "zipperhead",
               "whore",
               "hoe",
               "gay",
               "queer",
               "faggot",
               "homo",
               "homosexual",
               "fag",
               "lesbian",
               "butt",
               "crack",
               "meth",
               "cigarettes",
               "heroin",
               "weed",
               "bathsalts",
               "crocadil", 
               "cocaine",
               "wetback",
               "cholo",
               "aids",
               "herpes",
               "syphilus",
               "penis",
               "vagina",
               "nigger",
               "vodka",
               "whiskey", 
               "beer",
               "gin",
               "prostitute", 
               "hooker",
               "swag",
               "yolo",
               "YOLO",
               "SWAG",
               "cunt",
               "wang",
               "anus",
               "fuck face",
               "coon",] 
               
               
               
               
               
               
               
               
               

def displayStartScreen():
    print "Madlibs"
    raw_input("Press Enter to Continue")
    
def displayEndScreen():
    print "Goodbye"
    raw_input("Press Enter to Exit")

def getMenuOption(maxOption):
    option = ""
    goodOption = False
    while not goodOption:
        option = raw_input("Enter Number or Q> ")
        option = option.upper()
        for num in range(1, maxOption+1):
            if option == str(num):
                goodOption = True
        if option == 'Q':
            goodOption = True
        elif option == "c":
            goodOption = True
        if not goodOption:
            print "Please pick a valid option!"
    return option
        
def menu(options):
    print "------Please Select a Story------"
    print " [1] Play date"
    print " [2] The monster in the woods" 
    print " [3] Smash those Pumpkins" 
    print " [c] color change"     
    print " [Q] Quit"
    print "----------------------------------"
    option = getMenuOption(options)
    return option
    
def getWord(prompt):
    word = ""
    goodWord = False
    while not goodWord:
        word = raw_input(prompt)
        if word.lower() not in swearFilter:
            goodWord = True
        else:
            print "Naughty player...please be polite."
        if not goodWord:
            print "Try again"
    return word 
    
def getColor(prompt):
    colors = [ "black",
               "red",
               "blue"
               "orange", 
               "purple",
               "yellow",
               "dark blue",
               "dark red", 
               "light blue", 
               "light red", 
               "green",
               "light green",
               "dark green",
               "magenta",
               "brown",
               "dark brown",
               "teal",
               "white",
               "gray", 
               "silver", ]
    word = "" 
    goodColor = False 
    while not goodColor:
        color = raw_input(prompt)
        if color.lower() in colors:
            goodColor = True
        else:
            print "please enter a valid color"
        if not goodColor:
            print "Try again"
    return word
    
def getNumber(prompt, max = "", min = ""):
    num = ""
    goodNum = False
    while not goodNum:
        isNum = True
        num = raw_input(prompt)
        for character in num:
            if character not in "0123456789":
                isNum = False
        if min != "":
            if isNum:
                if float(num) < min:
                    isNum = False
        if max != "":
            if isNum:
                if float(num) > max:
                    isNum = False
        if isNum:
            goodNum = True
        else:
            print "Not a valid number, try again."
    return num
        
def story1():
    place1 = getWord("Enter a place to play: ")
    person1 = getWord(" please enter a name of a person: ") 
    game1 = getWord (" please enter a game: ") 
    game2 = getWord ( " please enter another game: ")
    game3 = getWord ( " please enter yet again, another game: ")
    food1 = getWord ( " please enter a food: ")
    place2 = getWord ( " please enter a place to live: ")
    place3 = getWord ( " please enter a place to sleep; ")     
    story = "I went to the"
    story += " " + place1 + " "
    story += "to play with"
    story += " " + person1 + " "
    story += "the games we played were"
    story += " " + game1 + " "
    story += "and" 
    story += " " + game2 + " " 
    story += "as well as"
    story += " " + game3 + " "
    story += "once we were done, we went to go get some"
    story += " " + food1 + " " 
    story += " then, after a long day of playing, we went back to our"
    story += " " + place2 + " " 
    story += " and went to" 
    story += " " + place3 + " "    
    story += " the end " 
    
    
    
    print story
    
def story2() :
    name1 = getWord(" Please enter your name: ")
    place1 = getWord(" please enter a creepy place to walk: ") 
    monster1 = getWord(" please enter the name of a monster: ")
    weapon1 = getWord(" please enter the name of a weapon: ")    
    story = "a kid named"
    story += " " +name1+ " "
    story += " went into the dark, dark," 
    story += " " +place1+ " " 
    story +=  " " +name1+ " " 
    story += " felt liked that they were being watched" 
    story += " " +name1+ " " 
    story += " turned around and saw the" 
    story += " " +monster1+ " " 
    story += " " +name1+ " " 
    story += " screamed and ran away from the" 
    story += " " +monster1+ " " 
    story += " as" 
    story += " " +name1+ " " 
    story += " was running away, you found an abandoned house. You go inside hoping it provides shelter from the monster. You end up finding a" 
    story += " " +weapon1+ " " 
    story += " once again, you go back outside. you look around and see the"
    story += " " +monster1+ " " 
    story += " hiding behind the trees, waiting to kill you, you take your" 
    story += " " +weapon1+ " " 
    story += " and kill the monster, you escape the dark, dark,"
    story += " " +place1+ " " 
    story += " and live happily ever-after"
    print story
    
def story3() : 
    noun1 = getWord( " please enter a noun: ") 
    noun2 = getWord( " please enter a noun: ")
    noun3 = getWord( " please enter another noun: ") 
    noun4 = getWord( " yet again.....another noun: ")
    noun5 = getWord( " noun plz: ")   
    noun6 = getWord( " this is going to have a lot of nouns, enter another: ") 
    noun7 = getWord( " noun again please: ") 
    noun8 = getWord( " anothers nouns pleases: ")
    noun9 = getWord( " (sigh) noun again: ")  
    noun10 = getWord( " you know the drill, noun: ") 
    noun11 = getWord( " noun: ") 
    noun12 = getWord( " nooooooooooooouuuuuuuuuunnnnnnnnn: ")     
    story = " The world is a"
    story += " " +noun1+  " " 
    story += " Sent to" 
    story += " " +noun2+ " " 
    story += " Secret destroyers, hold you up to the" 
    story += " " +noun3+ " "  
    story += " And what do I get, for my" 
    story += " " +noun4+ " " 
    story += " Betrayed" 
    story += " " +noun5+ " " 
    story += " And a piece of the" 
    story += " " +noun6+ " "
    story += " Even though I know, I suppose I'll show, all my" 
    story += " " +noun7+ " " 
    story += " and" 
    story += " " +noun8+ " " 
    story += " Like old" 
    story += " " +noun9+ " " 
    story += " Despite all my" 
    story += " " +noun10+ " "
    story += " I am still just a" 
    story += " " +noun11+ " " 
    story += " in a"
    story += " " +noun12+ " "     
    story += " Despite all my" 
    story += " " +noun10+ " " 
    story += " I am still just a"
    story += " " +noun11+ " "    
    story += " in a" 
    story += " "  +noun12+ " " 
    
    
    print story




    
    
def run():
    displayStartScreen()
    choice = ""
    while choice != 'Q':
        choice = menu(3)
        if choice == '1':
            story1()
        elif choice == '2':
            story2()
        elif choice == '3':
            story3()
        elif choice == 'Q':
            displayEndScreen()
        else:
            print "Something Awful Ocurred...yell at programmer!"
    exit()
run()